<script type="text/javascript">
<!--
	$(function(){
		$('#cashierProfile').validate({
			rules:{
				userPassword:{
					required: true,
					minlength: 6
				},
				rePassword:{
					required: true,
					equalTo: '#userPassword'
				}
		},
		messages:{
				userPassword: {
					required: 'Please enter a password',
					minlength: 'Password should be minimum of 6 characters'
				},
				rePassword: {
					required: 'Please enter a password',
					equalTo: "Password and Re-Password should be equal"
				}                      
			}
		});
	});
</script>
<div class="mainContent">
	<div class="masterData">
		<h3>My Profile</h3>
		<?php
			$userName = $_SESSION['userName'];
			include('./system/dbConnection.php');
			if($result=mysql_query("SELECT * FROM users WHERE userName = '$userName'")){
				if($row = mysql_fetch_array($result)){			
					echo "<table border='1' cellspacing='0' width='100%' class='masterTable'>";
					echo "<tr><td width='40%'><b>Full Name</b></td><td>&nbsp;&nbsp;".$row['userFullName']."</td></tr>";
					echo "<tr><td width='40%'><b>Address</b></td><td>&nbsp;&nbsp;".$row['userAddress']."</td></tr>";
					if($row['userTelephone'])
						echo "<tr><td width='40%'><b>Telephone</b></td><td>&nbsp;&nbsp;".$row['userTelephone']."</td></tr>";
					echo "<tr><td width='40%'><b>Reg. Date</b></td><td>&nbsp;&nbsp;".$row['userRegistrationDate']."</td></tr>";
					echo "<tr><td width='40%'><b>Last Log Date</b></td><td>&nbsp;&nbsp;".$row['lastLogDate']."</td></tr>";
					echo "</table>";	
				}else{
					echo "No Data in Database";
				}	
			}
		?>
	</div>
	<div class="mainForm">
		<h4>Change Password</h4>
		<form action="./system/action/cashierProfile.php" method="post" name="cashierProfile" id="cashierProfile">
			<table>
				<tr>
					<td colspan='2px'>
						<?php
						if(isset($_SESSION['error']) && $_SESSION['error'] != ""){ ?>
							<div class="error">
								<?php echo $_SESSION['error']; ?>
							</div>
						<?php } else if(isset($_SESSION['success']) && $_SESSION['success'] != ""){?>
							<div class="success">
								<?php echo $_SESSION['success']; ?>
							</div>
						<?php }?>					
					</td>
				</tr>
				<tr>
					<td align="left">PassWord <label class="mandatory">*</label></td>
					<td><input type = "password" name = "userPassword" id = "userPassword"></td>
				</tr>
				<tr>
					<td align="left">Re-Enter Password <label class="mandatory">*</label></td>
					<td><input type = "password" name = "rePassword"></td>
				</tr>
				<tr><td><input type = "submit" value = "Change" name = "submitPassword"></td></tr>
			</table>
		</form>	
	</div>
</div>